﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WinFormsApp1
{
    public class DataColumInfo
    {
        public string TableName { get; set; }
        public string ColumnName { get; set; }
        public string ColumnType { get; set; }
        public int ColumnLength { get; set; }
        public TableInfo RefExcel { get; set; }

    }

    public class DataColumInfoComparerTNC : IComparer<DataColumInfo>
    {
        public int Compare(DataColumInfo? x, DataColumInfo? y)
        {
            int t = x.ColumnType.CompareTo(y.ColumnType);
            if (t != 0) return t;
            t = x.ColumnName.CompareTo(y.ColumnName);
            if (t != 0) return t;
            t = x.ColumnLength.CompareTo(y.ColumnLength);
            if (t != 0) return t;
            t = x.TableName.CompareTo(y.TableName);
            if (t != 0) return t;
            return 0;
        }
    }

    /// <summary>
    /// 根据Name,Length进行排序
    /// </summary>
    public class DataColumInfoComparerNL : IComparer<DataColumInfo>
    {
        public int Compare(DataColumInfo? x, DataColumInfo? y)
        {
            int t = x.ColumnName.CompareTo(y.ColumnName);
            if (t != 0) return t;
            t = x.ColumnLength.CompareTo(y.ColumnLength);
            if (t != 0) return t;
            t = x.ColumnType.CompareTo(y.ColumnType);
            if (t != 0) return t;
            t = x.TableName.CompareTo(y.TableName);
            if (t != 0) return t;
            return 0;
        }
    }
}
